from rest_framework import serializers
from .models import Spit, Comment


class SpitListSerializer(serializers.ModelSerializer):
    class Meta:
        model = Spit
        fields = ('id', 'create_time', 'content', 'digested','source', 'like_count', 'clicks')


class SpitDetailSerializer(serializers.ModelSerializer):
    class Meta:
        model = Spit
        fields = ('id', 'source', 'content', 'like_count')


class CommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Comment
        fields = ('id', 'contents', 'spit_id', 'user_id', 'com_like_count')


class SpitCreateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Spit
        fields = ('id', 'create_time', 'content', 'digested','source', 'like_count')
